﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;
using System.ServiceModel;
using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Prism.Logging;
using Microsoft.Practices.Prism.Mvvm;
using Microsoft.Practices.Unity;
using Interfaces;

namespace Services
{
    [ServiceBehavior]
    public class NewsResultsService : INewsResultsService
    {
        private readonly IUnityContainer _container;

        public NewsResultsService()
        {
            _container = new UnityContainer();
            _container.RegisterType(typeof(INewsResult), typeof(NewsResult));
            _container.RegisterType(typeof(INewsResults), typeof(NewsResults));
        }

        public INewsResults Get(string keyword, int resultCount)
        {
            var res = (INewsResults)_container.Resolve(typeof(INewsResults));
            res.GetResults(keyword, resultCount);
            return res;
        }
    }
}
